< previous page page_148 next page >

Page 148
Type.gifListing 5.34. Coding the Let and Get methods for the CheckSize properties.
Public Property Get CheckSize() As Boolean
    CheckSize = m_CheckSize
End Property

Public Property Let CheckSize(ByVal vNewValue As Boolean)
    m_CheckSize = vNewValue
    PropertyChanged "CheckSize"
End Property

Public Property Get MinLength() As Variant
    MinLength = m_MinLength
End Property

Public Property Let MinLength(ByVal vNewValue As Variant)
    '
    If IsNumeric(vNewValue) = False Then
        Error 380 ' invalid property
    Else
        m_MinLength = Val(vNewValue)
        PropertyChanged "MinLength"
    End If
    '
End Property

Public Property Get MaxLength() As Variant
    MaxLength = m_MaxLength
End Property

Public Property Let MaxLength(ByVal vNewValue As Variant)
    '
    If IsNumeric(vNewValue) = False Then
        Error 380 ' invalid property
    Else
        m_MaxLength = Val(vNewValue)
        PropertyChanged "MaxLength"
    End If
    '
End Property
Notice, again, the use of IsNumeric() and the Error keyword to check for and report invalid property values. After completing the new properties, create a new Public Sub called CheckSizeValidate and enter the code shown in Listing 5.35.

 
< previous page page_148 next page >

If you like this book, buy it!